package com.taptech.doufu.ui.viewholder.personalcenter;

import android.content.Context;
import androidx.recyclerview.widget.StaggeredGridLayoutManager;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.taptech.doufu.R;
import com.taptech.doufu.bean.MineAbstractBean;
import com.taptech.doufu.bean.NullBean;
import com.taptech.doufu.ui.view.drawcircle.BaseRecyclerViewViewHolder;

/**
 * Created by lsy on 2015/10/8.
 */
public class NullRecyclerViewHolder<T extends NullBean> extends BaseRecyclerViewViewHolder {

    View viewGroup ;

    public NullRecyclerViewHolder(Context context, View itemView) {
        super(context, itemView);
        viewGroup = itemView.findViewById(R.id.null_layout_ground);
        StaggeredGridLayoutManager.LayoutParams layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
        layoutParams.setFullSpan(true);
        itemView.setLayoutParams(layoutParams);
    }

    @Override
    public void setViewHolderChildViewContent(MineAbstractBean tempbean, int position) {
        T bean = (T)tempbean;
        if (bean == null){
            return;
        }
        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT , bean.getHeight() );
        viewGroup.setLayoutParams(params);
    }
}
